#!/usr/bin/env perl

use utf8;
use strict;

my $fh;

if(@ARGV != 0){
	open $fh, '<', $ARGV[0];	
	while(<$fh>){
		chomp;
		if(/(?<word>\w*a\b)/){
			print "'word' contains '$+{word}'\n";
		}
		else{
			print "Not match:|$_|\n";
		}
	}
}
else{
	while(<>){
		chomp;
		if(/(?<word>\w*a\b)(?<after>.{0,5})/){
			print "'word' contains '$+{word}', 'after' contains '$+{after}'\n";
		}
		else{
			print "Not match:|$_|\n";
		}
	}
}
